home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / ZTIMER11.ARJ / MAIN.PAS < prev    next >
Pascal/Delphi Source File  |  1992-04-20  |  1KB  |  50 lines

  1. program main;
  2.  
  3. { Test of Zen Timer.  Timer by Michael Abrash, test by Kendall Bennett. }
  4. { Translation of main.c into Turbo Pascal by Duncan Murdoch. }
  5.  
  6. uses ztimer;
  7.  
  8. procedure ReportTime(count:longint);
  9. begin
  10.         writeln('Time taken: ',count/1000000:12:6);
  11. end;
  12.  
  13. var
  14.   i,j : integer; { NON register variables! }
  15.   count : longint;
  16. begin
  17.         { Test the precision timer routine }
  18.  
  19.         _PZTimerOn;
  20.         for i := 0 to 10000 do
  21.                 i := i;
  22.         _PZTimerOff;
  23.         _PZTimerReport;
  24.         count := _PZTimerCount;
  25.         writeln('Count returned: ',count);
  26.  
  27.         { Test the precision timer routine for overflow }
  28.  
  29.         _PZTimerOn;
  30.         for j := 1 to 20 do
  31.                 for i := 0 to 10000 do
  32.                         i := i;
  33.         _PZTimerOff;
  34.         _PZTimerReport;
  35.         count := _PZTimerCount;
  36.         writeln('Count returned: ',count);
  37.  
  38.         { Test the long period Zen Timer (we don't check for overflow coz
  39.           it would take tooooo long!)
  40.         }
  41.  
  42.         _LZTimerOn;
  43.         for j := 1 to 20 do
  44.                 for i := 0 to 10000 do
  45.                         i := i;
  46.         _LZTimerOff;
  47.         _LZTimerReport;
  48.         ReportTime(_LZTimerCount);
  49. end.
  50.